<template>
  <div></div>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router'

const route = useRoute()
const router = useRouter()
const { params, query } = route
const { path } = params
// 执行重定向（replace替换当前路由）
router.replace(
    { 
      path: '/' + path, // 将捕获的路径拼接到根路径
      query // 保留所有URL查询参数
    }
)
</script>